/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.latesis.dao.hibernate;

import com.latesis.bean.TrackingBean;
import com.latesis.bean.TrackingBean;
import com.latesis.dao.TrackingDAO;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author acabrera
 */
@Transactional(propagation=Propagation.SUPPORTS)
public class TrackingDAOHibernateImpl extends HibernateDaoSupport implements TrackingDAO{
    public TrackingBean guardar(TrackingBean bean) {
         getHibernateTemplate().saveOrUpdate(bean);
         return bean;
    }

    public void borrar(TrackingBean bean) {
        getHibernateTemplate().delete(bean) ;
    }

    public TrackingBean buscar(TrackingBean bean) {
        return getHibernateTemplate().get(TrackingBean.class, bean.getId());
    }

    public List<TrackingBean> buscarTodos() {
        return (List<TrackingBean>)getHibernateTemplate().find("from TrackingBean ");
    }
}
